<?php
/***
* @version $Id: profile.php 336 2007-01-23 08:12:56Z flexiondotorg $
* @copyright (c) 2006 - 2007 Flexion.Org
*            (c) 2005 - 2006 aboyd (Tony Boyd) http://www.outshine.com/forums/
*            (c) 2005 - 2006 pichirichi <pichirichi@pichirichi.com> http://www.pichirichi.com
*            (c) 2004 - 2005 Project Minerva
*            (c) 2003 - 2004 A_Jelly_Doughnut < support@jd1.clawz.com > (n/a) http://jd1.clawz.com
*            (c) 2001 - 2006 phpBB Group
* @license   http://opensource.org/licenses/gpl-license.php GNU Public License
***/

define('IN_R3BORN', true);
$root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'),	1);
include($root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
init_userprefs($userdata);
//
// End session management
//

// session id check
$sid = get_var('sid', '');

//
// Start of program proper
//
$mode = get_var('mode','');
if ( $mode != '' )
{
	if ( $mode == 'viewprofile' )
	{
		include($root_path . 'includes/usercp/usercp_viewprofile.'.$phpEx);
		exit;
	}
	elseif ( $mode == 'editprofile')
	{
		if ( !$userdata['session_logged_in'] )
		{
			redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
		}
		elseif ( $userdata['session_logged_in'] )
		{
			include($root_path . 'includes/usercp/usercp_editprofile.'.$phpEx);
			exit;
		}

	}
	elseif ( $mode == 'email' )
	{
		include($root_path . 'includes/usercp/usercp_email.'.$phpEx);
		exit;
	}
}

redirect(append_sid("index.$phpEx", true));

?>